package com.example.framework.interfaces;

/**
 * 
 * @author renxin.sun
 *
 */
public interface AsyncTaskInterface
{

	/**
	 * Callback Interface. Callback method runs in main thread.
	 * 
	 * @author renxin.sun
	 * 
	 * @param <T>
	 */
	public interface CallEarliest<T>
	{

		public void onCallEarliest() throws Exception;
	}

	/**
	 * Callback Interface. Callback method runs in another thread.
	 * 
	 * @author renxin.sun
	 * 
	 * @param <T>
	 */
	public interface Callable<T>
	{

		public T call() throws Exception;
	}

	/**
	 * Callback Interface. Callback method runs in main thread.
	 * 
	 * @author renxin.sun
	 * 
	 * @param <T>
	 */
	public interface Callback<T>
	{

		public void onCallback(final T callbackValue);
	}

	/**
	 * 
	 * @author renxin.sun
	 * 
	 */
	public interface ProgressListener
	{

		public void onProgressChanged(final int progress);
	}

	/**
	 * 
	 * @author renxin.sun
	 * 
	 * @param <T>
	 */
	public interface ProgressCallable<T>
	{

		public T call(final ProgressListener progressListener) throws Exception;
	}

	/**
	 * Callback Interface. Callback method runs in main thread.
	 * 
	 * @author renxin.sun
	 * 
	 */
	public interface OnCallBack
	{
		void OnSuccess(String callbackValue);

		void OnError();

		void OnFailed();
	}
	
	/**
	 * Callback Interface. Callback method runs in main thread.
	 * 
	 * @author renxin.sun
	 *
	 */
	public interface OnPreCall
	{
		void SetUrlAndParams(PreCallListener preCallListener);
	}

	/**
	 * 
	 * @author renxin.sun
	 *
	 */
	public interface PreCallListener
	{
		void SetUrl(final String url);
		
		void SetParams(final String params);
	}
	
}
